import request from "@/utils/request";

// 获取专栏列表
export function getCourselList(page, formInline) {
  return request({
    url: "/admin/s/column",
    method: "get",
    params: {
      page,
      ...formInline
    }
  });
}

// 添加专栏
export function addCourse(ruleForm) {
  return request({
    url: "/admin/s/column/save",
    method: "post",
    data: { ...ruleForm }
  });
}

// 删除课程
export function delCourse(ids) {
  return request({
    url: "/admin/s/column/delete",
    method: "post",
    data: { ids }
  });
}

// 上架 下架
export function updateStatus(id, status) {
  return request({
    url: "/admin/s/column/updatestatus",
    method: "post",
    data: { id, status }
  });
}

// 修改专栏更新状态
export function updateStatus(id, isend) {
  return request({
    url: "/admin/s/column/updateend",
    method: "post",
    data: { id, isend }
  });
}

// 更新专栏
export function updateCourse(data) {
  return request({
    url: "/admin/s/column/update",
    method: "post",
    data
  });
}

// 查询专栏详细信息
export function readCourse(id) {
  return request({
    url: "/admin/s/column/read?id=3",
    method: "get",
    params: { id }
  });
}

// 专栏目录列表
export function updateCourse(column_id, page) {
  return request({
    url: "/admin/s/column_course",
    method: "get",
    data: { column_id, page }
  });
}

// 新增专栏目录
export function updateCourse(column_id, course_id) {
  return request({
    url: "/admin/s/column_course/save",
    method: "post",
    data: { column_id, course_id }
  });
}

// 专栏目录排序
export function sortCourse(ids, column_id) {
  return request({
    url: "/admin/s/column_course/sort",
    method: "post",
    data: { ids, column_id }
  });
}

// 删除专栏目录
export function delCourse(ids, column_id) {
  return request({
    url: "/admin/s/column_course/delete",
    method: "post",
    data: { ids, column_id }
  });
}